﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="Register" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <title>注册</title>
    <%--layui--%>
    <link href="Com/layui/css/layui.css" rel="stylesheet" />
    <script src="Com/layui/layui.js"></script>
    <script src="Com/JS/jquery-1.8.0.min.js"></script>
    <script src="Com/JS/jquery.form.js"></script>




    <style>
        .Registerdiv {
            border-color: #aaa;
            margin: 120px auto;
            width: 500px;
            border-radius: 6px;
            box-shadow: 0 0px 8px #ccc;
            padding-left: 40px;
            height: 460px;
            padding-top: 40px;
            background: #F2F2F2;
        }

        .layui-input {
            width: 251px;
        }

        .register {
            color: rgb(51, 51, 51);
            letter-spacing: 1px;
            margin: 0px 0px 14px -20px;
            font: 22px 微软雅黑;
        }
    </style>
</head>
<body>
    <form class="layui-form" action="/Handler/SoultionHandler.ashx?action=Register" id="RegisterForm" enctype="multipart/form-data" method="post">
        <div class="Registerdiv">
            <p class="register">注册</p>
            <div class="layui-form-item">
                <label class="layui-form-label">姓名：</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" required lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">手机号：</label>
                <div class="layui-input-inline">
                    <input type="text" name="phone" required lay-verify="required" placeholder="请输入手机号" autocomplete="off" class="layui-input" id="phone">
                </div>
                <div class="layui-form-mid layui-word-aux" style="margin-left: 70px;">登录名</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">密码：</label>
                <div class="layui-input-inline">
                    <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </div>
    </form>

    <script>

        //表单提交完成
        function showResponse(data, status) {
            var obj = eval('(' + data + ')');
            if (obj.status == 1) {
                layer.msg(obj.info, {
                    time: 1000 //2秒关闭（如果不配置，默认是3秒）
                }, function () {
                    window.location.href = "Login.aspx";
                });

            }
            else {
                layer.msg(obj.info, {
                    time: 1000 //2秒关闭（如果不配置，默认是3秒）
                });
            }
        }

        //Demo
        layui.use('form', function () {
            var form = layui.form();

            //监听提交
            form.on('submit(formDemo)', function (data) {
                var phone = $("#phone").val();
                if (!(/^1[34578]\d{9}$/.test(phone))) {
                    //layer.msg("手机号码有误，请重填", { 
                    //    time: 1000 //2秒关闭（如果不配置，默认是3秒）
                    //});
                    alert("手机号码有误，请重填");
                    return false;
                }
                //layer.msg(JSON.stringify(data.field));

                var option = {
                    dataType: 'jsonp',
                    url: '/Handler/SoultionHandler.ashx?action=Register',
                    success: showResponse
                };
                $('#RegisterForm').ajaxForm(option);
            });
        });


    </script>
</body>
</html>
